#include "defines.hpp"

Menu::Menu()
{
    

}

void Menu::Teclas (int key, Cena & cena){

    if(key == GLUT_KEY_F1){
	    cena.SetAtivo(true);
	}

     glutPostRedisplay();
}


void Menu::Renderiza()
{
    glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
    glEnable(GL_DEPTH_TEST);
    
	glLoadIdentity();
    glColor3f(0,0,1);    
	
	std::string titulo("Space Invader - CG");
    glRasterPos2f(-0.3, 0.70);
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, titulo);

	glRasterPos2f(-0.7, 0.60);
	std::string muda("Pressione F1 para alternar entre menu e Jogo.");
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, muda);

	glRasterPos2f(-0.5, 0.40);
	std::string credito1("Grupo: Fabricio Jorge Barboza de Oliveira");
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, credito1);
	
	glRasterPos2f(-0.27, 0.30);
	std::string credito2("Carlos");
    Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, credito2);
	
	glRasterPos2f(-0.27, 0.20);
	std::string credito3("Bruno");
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, credito3);

	glRasterPos2f(-0.27, 0.10);
	std::string credito4("Vitor");
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, credito4);
	
	glRasterPos2f(-0.27, 0.0);
	std::string credito5("Marcelo");
	Print_Bitmap_String(GLUT_BITMAP_TIMES_ROMAN_24, credito5);
    
   glutSwapBuffers();
}


void Menu::Print_Bitmap_String(void * font, std::string cont){
      char * cstr;
      int tamanho = 0;
      size_t size = cont.length();
      for (tamanho=0;tamanho<(int)size;tamanho++)
      {
        cstr = &cont[tamanho];
        glutBitmapCharacter(font, *cstr);}

}

Menu::~Menu()
{
    //dtor
}
